
package com.borqs.music.lyric;

import android.content.Context;
import android.graphics.Canvas;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SlidingDrawer;

public class LyricSlidingDrawer extends SlidingDrawer {

    public LyricSlidingDrawer(Context paramContext, AttributeSet paramAttributeSet) {
        this(paramContext, paramAttributeSet, 0);
    }

    public LyricSlidingDrawer(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
        super(paramContext, paramAttributeSet, paramInt);
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        long time = getDrawingTime();
        View handle = super.getHandle();
        View content = super.getContent();
        drawChild(canvas, handle, time);
        if (!isOpened() || isMoving()) {
            canvas.save();
            float f2 = handle.getBottom() - content.getTop();
            canvas.translate(0, f2);
            drawChild(canvas, content, time);
            canvas.restore();
        } else {
            super.dispatchDraw(canvas);
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == Event.OFFLINE) {
            int i = super.getHandle().getBottom();
            int j = (int)event.getY();

            if (j > i) {
                int k = i+20;
                if (j <= k) {
                    animateToggle();
                }
            }
        }
        return super.onTouchEvent(event);
    }
}
